#ifndef FILE_tvOpenCV_ImageIO_h
#define FILE_tvOpenCV_h

#include <opencv/cv.h>
#include "tvRawImageIO.h"

class TvOpenCV_ImageIO
{

public:
	TvOpenCV_ImageIO() {;} ;
	~TvOpenCV_ImageIO() {;} ;


	// Load PGM methods
	IplImage * loadPGM(char *file_in_name, const bool bigEndian = true);
	bool loadPGM(char *file_in_name, IplImage * src, const bool bigEndian = true);

	// Load PPM methods
	IplImage * loadPPM(char *file_in_name, const bool bigEndian = true);

	// Write PGM to file named "file_out_name"
	bool writePGM(
		char *file_out_name, IplImage * src,
		const bool bigEndian = true );

	// Raw Image data to/from file
	IplImage * loadRawDataImage(char *file_in_name);
	bool loadRawDataImage(char *file_in_name, IplImage * src);
	bool writeRawDataImage(char *file_out_name, IplImage * src,	char * comments = NULL);

private:
	TvRawImageIO rawIO;
	bool setImageSize(IplImage* src, TvImageSize & imageSize);
	int  getIplDepth(TvImageSize & imageSize);

};



#endif // FILE_tvOpenCV_h
